In case you haven’t come across this before you can actually compare two views in SQL Data Compare. The only pre-requisite is that the view has an index defined on it. As an example lets create and compare an indexed view on pubs.
First we must create the view with the schema binding option:
1 2 3 4 5 6 7 8 9 10 |
CREATE VIEW cheap_titles WITH SCHEMABINDING as SELECT titles.title_id, titles.title, titles.type, titles.pub_id, titles.price, titles.advance, titles.royalty FROM dbo.titles WHERE price < 5.00 GO |
We now need to create the index on the view:
1 |
CREATE UNIQUE CLUSTERED INDEX cheap_titles_unique ON cheap_titles(title_id) |
When we now use SQL Data Compare to compare two databases with this indexed view defined we are given the option of including it in the comparison.
Load comments